import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes:[
        {
            name: 'main',
            path: '/main',
            component: () => import('../components/MainLabel.vue'),
            // beforeEnter:(to,from)=>{
            //     if(from.path==='login'){
            //         from.path=''
            //     }
            // }
        },
        {
            name: 'login',
            path: '/',
            component: () => import('../components/LoginLabel.vue'),
        }
    ]
});

// 全局路由守卫: 初始化时候调用，每次路由切换前调用
// router.beforeEach((to,from,next)=>{

// })
export default router;
